<?php
namespace Managers;

use Catalog\Categories;

class Catalog extends BaseManager{


    public function deleteById($id){
        $query = 'update news set name="test2" where id='.$id;
        $em = $this->getEntityManager();
        $res = $em->getConnection()->executeQuery($query);
	    return $res;
    }

	public function getList(){
		$query = 'select * from items';
      //print_r($query);
        $em = $this->getEntityManager();
        $res = $em->getConnection()->executeQuery($query)->fetchAll();
       // print_r($res);
	    return $res;
	}
    public function NEWS ($news_id){
        $id=$news_id;
        $query="select n.text,n.neme from news n where id =$id";
        $em = $this->getEntityManager();
        $result = $em->getConnection()->executeQuery($query)->fetchAll();
        return $result;
    }
     public function AUTOR ($news_id){
        $id=$news_id;
        $query="select n.text,n.neme from news n where id =$id";
        $em = $this->getEntityManager();
        $result = $em->getConnection()->executeQuery($query)->fetchAll();
        return $result;
    }

    public function getBrands ($brand){

         $query = "select * from items where brand='$brand'";

        $em = $this->getEntityManager();
        $res = $em->getConnection()->executeQuery($query)->fetchAll();
	    return $res;

    }
       public function getCategory ($cat){

         $query = "select * from items where category='$cat'";

        $em = $this->getEntityManager();
        $res = $em->getConnection()->executeQuery($query)->fetchAll();
	    return $res;

    }
}